/**
 * UVa 146 ID codes
 * Author: chchwy
 * Last Modified: 2011.03.16
 * Blog: http://chchwy.blogspot.com
 */
#include<iostream>
using std::cout;
using std::endl;

int solution[5];

void backtrack(int n) {
    if(n==3){
        for(int i=0;i<3;++i)
            cout<<solution[i]<<" ";
        cout<<endl;
        return;
    }

    //
    for(int i=0;i<10;++i) {
        solution[n] = i;
        backtrack(n+1);
    }
}

void n_tuples() {
    backtrack(0);
}

int main() {
    n_tuples();
    return 0;
}
